//
//  LiveBusinessConfig.h
//  ParentsCommunity
//
//  Created by caiyonghao on 2017/3/14.
//  Copyright © 2017年 XES. All rights reserved.
//
//-------------------类描述-----------------------
//   title:
//    直播配置文件
//
//   detail:
//-------------------end-------------------------

#ifndef LiveBusinessConfig_h
#define LiveBusinessConfig_h

// ControlView 返回键 展示信息
static NSString * const kLiveTipTitle_Default   = @"返回";
// ControlView 按钮键tag - 网络错误
static int const kBadNetworkTag = 2000;
// ControlView 按钮键 展示信息
static NSString * const kLiveTipTitle_Play      = @"重试";

/** 回放使用的key字段 */
static int  const kPlayFailTag = 1000;  
static int  const kHttpFailTag = 1001;
static int  const kPlayNetFailTag = 1002;
static int  const kPlayDispatchErrorTag = 1003;
/** end */

// 直播初始化场景(WXLiveInitScene) 提示信息
static NSString * const kLivePlayerInit_Tip = @"正在获取视频资源，请稍候...";
#define kLivePlayerRedispatchWithErrorMsg(errorMsg)  [NSString stringWithFormat:@"获取视频资源失败[%ld],正在尝试重连...",(long)errorMsg]
#define kLivePlayerMediaLoadingTimeOut          @"视频连接超时[300]，正在尝试重连…"
#define kLivePlayerMediaPlayEnd                 @"老师不在直播间[200]"
#define kLivePlayerMediaPlayErr                 @"视频播放失败"
#define kLivePlayerMediaPlayErrWithErrorMsg(errorMsg) [NSString stringWithFormat:@"视频播放失败[%@]",errorMsg]
static NSString * const kChangeLiveSataus_Live  = @"正在连接到主讲老师，请耐心等候...";
static NSString * const kChangeLiveSataus_Tutor = @"正在连接到辅导老师，请耐心等候...";
//直播初始化场景(WXLiveInitScene) 提示信息 - 旧版
static NSString * const kLiveInit_Tip           = @"正在初始化数据，请稍候...";
static NSString * const kLiveReconnect          = @"正在重连，请稍候...";

// 直播调度失败 提示信息
#define kLivePlayerTeacherOrDeputyNotInRoom     @"老师在赶来的路上 [500]"
#define kLivePlayerDispatchErrorMsg(errorMsg)  [NSString stringWithFormat:@"获取视频资源失败[%ld]",(long)errorMsg]
#define kLiveRoomLogoutMsg                      @"您的帐号已在其他设备登录，请重新登录"
#define kLivePlayerNetworkException             @"连接超时，请检查网络 [400]"
// 直播调度失败 提示信息 - 旧版
static NSString * const kLiveNetwork_Bad        = @"网络不给力，请检查网络连接状态";
static NSString * const kLiveRtmpFromValue      = @"iOS";         // 流请求来源
static NSString * const kLiveRtmpFromKey        = @"rtmp_flashver"; // 流请求Key
// 错误提示 - 旧版
#define kLiveInitFail_ErrorMsg(errorMsg)  [NSString stringWithFormat:@"数据初始化失败，请重试:%@",errorMsg]
#define kLiveDispatch_ErrorMsg(errorMsg)  [NSString stringWithFormat:@"数据调度失败，请重试:%@",errorMsg]
#define kLiveCacheData_ErrorMsg(errorMsg) [NSString stringWithFormat:@"缓存信息读取失败，请重试:%@",errorMsg]


// 老师离开
#define kLiveTeacherLeave_name(name)   [NSString stringWithFormat:@"teacher leave with memberName = %@",name]
// 直播url
#define kLiveRtmp_Url(url)  [NSString stringWithFormat:@"rtmp url = %@",url]


//直播讲座聊天区链接被点击通知
#define kLiveLectureClickLinkNotification   @"LiveLectureClickLinkNotification"

//在userInfo里取链接的key值
#define kLiveLectureLinkKey                 @"LiveLectureLinkKey"

static NSString * const kLinkLiveLectureFromTypeKey =  @"fromtype";  //超链接来源Key

static NSString * const kLinkLiveLectureFromTypeValue = @"livelecturechat"; //超链接来源Value

static NSString * const kLinkLiveLectureFromPlatformTypeKey = @"fromplatformtype"; //超链接来源平台key

static NSString * const kLinkLiveLectureFromPlatformTypeValue = @"iOS";  //超链接来源平台Value

static NSString * const kLinkLiveLectureFromLiveIdKey = @"fromliveid";   //超链接来源直播讲座idKey

static NSString * const kLiveLiveLectureFormUserId = @"fromuserid";  //当前用户Id

#define kDeputyTeacher @"in-training" // 辅导老师
#define kTeacher       @"in-class"    // 主讲老师

/** 当前直播的状态 */
typedef NS_ENUM(NSInteger,WXLiveStatus){
    
    WXLiveStatus_InitRequst,            // 初始化请求中
    
    WXLiveStatus_DispatchRequest,       //调度中
    WXLiveStatus_DispatchSuccess,       //调度成功
    WXLiveStatus_LivePreparePlay,       //准备播放
    WXLiveStatus_LiveDuration,          //直播中
    WXLiveStatus_LiveIsBuffering,       //缓冲中
    
    WXLiveStatus_OccurErr,              //出错
    WXLiveStatus_liveOnMic,             //上麦
};

/** 直播失败枚举 */
typedef NS_ENUM(NSInteger , WXLiveErrCode){
    
    WXLiveErrCodeDispatchTimeOut, //调度失败 - 超时
    WXLiveErrCodeDispatchBussinessException, //调度失败 - 业务异常
    WXLiveErrCodeDispatchNetErr, //调度失败 - 网络错误
    WXLiveErrCodePlayerLoadingTimeOut, //加载超时
    WXLiveErrCodePlayerBufferingTimeOut, //缓冲超时
    WXLiveErrCodePlayerPlayEnd, //直播错误-直播结束
    WXLiveErrCodePlayerPlayErr, //直播错误-视频流已中断
    WXLiveErrCodePausedOnMic, // 接麦中
    WXLiveErrCodePausedOnModeChanged, //切直播、辅导态
    WXLiveErrCodePausedOnLogout, // 踢出
    WXLiveErrCodePausedOnNetworkException, //无网络
    WXLiveErrCodePausedOnSuspend, //挂起
    WXLiveErrCodeLineChanging,             //线路切换
    WXLiveErrCodeLineRefreshing,           //线路重新加载
    WXLiveErrCodeLiveStop,              //直播停止
    WXLiveErrCodeLineChatLinkClick,     //聊天链接被点击
    WXLiveErrCodeLinePicTopicForceClosed, //画中画强制被关闭
    WXLiveErrCodeSuperLecturer,         //演讲秀
};

/** 直播初始化场景 */
typedef NS_ENUM(NSInteger , WXLiveInitScene){
    WXLiveInitSceneInit,              // 初始化
    WXLiveInitSceneDispatchTimeOut,     // 调度-超时 重连
    WXLiveInitSceneDispatchBusinessErr, // 调度-业务失败 重连
    WXLiveInitSceneDispatchNetErr,      // 调度-网络错误 手动重连
    WXLiveInitSceneLiveLoadingTimeOut,  // 播放器加载20s超时 重连
    WXLiveInitSceneLiveBufferingTimeOut,// 播放器缓冲超时 重连
    WXLiveInitSceneLiveEnd,             // 播放器播放完成 重连
    WXLiveInitSceneLiveErr,             // 播放器播放断流 重连
    WXLiveInitSceneMacIsClosed,         // 下麦 重连
    WXLiveInitSceneChangeTeacherMode,   // 切换主讲态 重连
    WXLiveInitSceneChangeDeputyMode,    // 切换辅导态 重连
    WXLiveInitSceneLogout,              // 踢出 手动重连
    WXLiveInitSceneNetworkChanged,      // 网络连接 重连
    WXLiveInitSceneEnterForeground,     // app进入前台重新调度 重连
    WXLiveInitSceneChangeLineState,     //切换线路模式
    WXLiveInitSceneLineReload,          //线路切换重新加载
    WXLiveInitSceneChannelNotExist,     //线路不存在(业务上只处理界面，播放器不重置)
    WXLiveInitSceneSuperLecturer,       //演讲秀开启
};

typedef NS_ENUM(NSInteger, LiveType) {
    
    kLiveType_liveCourse = 3,   // 直播课
    kLiveType_liveTutorial = 1, // 直播辅导
    kLiveType_liveLecture =2,   // 直播讲座(公开直播）
    kLiveType_liveClassTest =4,   // 课堂巩固
};

typedef NS_ENUM(NSInteger, LiveLightType) {
    LiveLightTypeLive,
    LiveLightTypeLiveBack,
};

//直播间推流样式
typedef NS_ENUM(NSInteger, LiveRoomStreamModeType)
{
    LiveRoomStreamModeTypeNormal,     //普通三分屏
    LiveRoomStreamModeTypeStandLive,  //全身直播
    LiveRoomStreamModeTypeHalfLength, //半身直播
    LiveRoomStreamModeTypeLittleClass,//小班体验课  已移除
    LiveRoomStreamModeTypeRecordStandLive, // 高清录直播
    LiveRoomStreamModeTypeVirtualRecordStandLive,//虚拟高清录直播（学生假流）
};

//皮肤类型
typedef NS_ENUM(NSInteger, LiveSubjectAndGradeType) {
  
    kLiveSubjectAndGradeType_normal,           //普通皮肤
    kLiveSubjectAndGradeType_primaryEnglish,   // 小学英语皮肤
    kLiveSubjectAndGradeType_primaryScience,   // 小学理科皮肤
    kLiveSubjectAndGradeType_primaryChinese,
};

typedef NS_ENUM(NSInteger,LiveFullScoreRankType) {
    LiveFullScoreRankTypeTeam = 0,          //互动-测试卷
    LiveFullScoreRankTypeTeamTest = 1,      //互动-互动题
    LiveFullScoreRankTypeTeamWareH5 =2,     //课件-互动课件
};


//语音互动题交互状态
typedef NS_ENUM(NSInteger, LiveHFPQuestionStatus) {
    
    LiveHFPQuestionStatusNone,         //初始状态
    LiveHFPQuestionStatusSpeechStart,  //开始评测
    LiveHFPQuestionStatusSpeechEnd,    //结束评测
    LiveHFPQuestionStatusSpeechError,  //评测失败
    LiveHFPQuestionStatusCommitAnswer, //提交答案
    LiveHFPQuestionStatusSuccess,      //题目作答成功
} ;

#pragma mark - 大班专用
typedef NS_ENUM(NSInteger , LiveNewSkinType){
    /** 小学 */
    LiveNewSkinTypePrimary = 1,
    /** 初高中 */
    LiveNewSkinTypeHigh = 2,
};


#endif /* LiveBusinessConfig_h */
